//2009/08/08 12:55:31
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>

using namespace std;

class SoldierLabeling
{
public:
    int count(int n, int lowerBound, int upperBound)
    {
		string low(lowerBound - 1, '9');
		int lowInt = convertStringToInteger(low) + 1;
		string upper(upperBound, '9');
		int upperInt = convertStringToInteger(upper);
		if(lowInt > n) return 0;
		if(upperInt > n) return n - lowInt + 1;
		return upperInt - lowInt + 1;
    }
private:
    int convertStringToInteger(string s)
    {
        stringstream ss(s);
        int number;
        ss >> number;
        return number;
    }
};

